package com.learn.activiti.delegate;

import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;
import org.activiti.engine.impl.persistence.entity.VariableInstance;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <一句话描述>
 *
 * @author xianglujun
 * @date 2019/7/12 15:38
 */
@Service
@Slf4j
public class LogDelegateTask implements JavaDelegate {


    @Override
    public void execute(DelegateExecution execution) throws Exception {
        // 直接输入参数内容即可
        Map<String, VariableInstance> variableMap = execution.getVariableInstances();
        for (Map.Entry<String, VariableInstance> entry : variableMap.entrySet()) {
            log.info("key: {}, value:{}", entry.getKey(), entry.getValue());
        }

        execution.setVariable("done", true);
    }
}
